import request from "@/utils/request";

// 查询告警规则配置分类列表
export function listType(query) {
  return request({
    url: `/datahandler/alertrule/type/list`,
    method: "get",
    params: query,
  });
}

//告警规则 左边树
export function fetchTreeList(data) {
  return request({
    url: `/datahandler/alertrule/type/queryAllTypeTreeWithData`,
    method: "post",
    data,
  });
}

//告警规则分类  新增
export function typeTreeAdd(data) {
  return request({
    url: `/datahandler/alertrule/type/add`,
    method: "post",
    data,
  });
}

//告警规则分类  编辑
export function typeTreeEdit(data) {
  return request({
    url: `/datahandler/alertrule/type/edit`,
    method: "post",
    data,
  });
}

//告警规则分类  删除
export function typeTreeDelete(data) {
  return request({
    url: `/datahandler/alertrule/type/remove`,
    method: "post",
    data,
  });
}

//告警规则下拉列表
export function fetchOptions(params) {
  return request({
    url: `/datahandler/alertrule/type/queryAlertRuleParamByParamType`,
    method: "get",
    params,
  });
}

//告警合并字段
export function fetchMergeField(data) {
  return request({
    url: `/datahandler/alertrule/type/getColumnList`,
    method: "post",
    data,
  });
}

//告警规则 右侧列表
export function fetchRuleList(query) {
  return request({
    url: `/datahandler/alertrule/list`,
    method: "get",
    params: query,
  });
}

//获取告警规则详细信息
export function ruleDetail(query) {
  return request({
    url: `/datahandler/alertrule/getInfo`,
    method: "get",
    params: query,
  });
}

//新增 告警规则
export function ruleAdd(data) {
  return request({
    url: `/datahandler/alertrule/add`,
    method: "post",
    data,
  });
}

//修改 告警规则
export function ruleEdit(data) {
  return request({
    url: `/datahandler/alertrule/edit`,
    method: "post",
    data,
  });
}

//批量修改告警规则状态
export function ruleStatusBatchEdit(data) {
  return request({
    url: `/datahandler/alertrule/editMulti`,
    method: "post",
    data,
  });
}

//删除 告警规则
export function ruleDelete(data) {
  return request({
    url: `/datahandler/alertrule/remove`,
    method: "post",
    data,
  });
}

//获取告警码列表
export function alarmCodeList(data) {
  return request({
    url: `/datahandler/alertrule/getAlarmCodeInfoList`,
    method: "post",
    data,
  });
}

export function addAlarmInfo(data) {
  return request({
    url: `/datahandler/alertrule/addAlarmCode`,
    method: "post",
    data,
  });
}
//规则编码
export function autoRuleCode(query) {
  return request({
    url: `/datahandler/alertrule/autoRuleCode`,
    method: "get",
    params: query,
  });
}

export function getColumnList(data) {
  return request({
    url: `/datahandler/alertrule/type/getColumnList`,
    method: "post",
    data,
  });
}
